/**
 * related to index.ui
 * 
 * @Author : 18668972585
 * @Timestamp : 2017-06-02
 */

/*********************************************************/
//获取segmentview，绑定listdata
var do_segmentview_1 = ui("do_segmentview_1");
var segment_listdata = mm("do_ListData");
do_segmentview_1.bindItems(segment_listdata);

//获取slideview，绑定listdata
var do_slideview_1 = ui("do_slideview_1");
var slide_listdata = mm("do_ListData");
do_slideview_1.bindItems(slide_listdata);
segment_listdata.addData([
{template: 0,name:"会诊专家", fontColor : "F4A415FF", lb:false},                   
{template: 0,name:"我的会诊", fontColor : "B3B3B3FF", lb:false},
]);
 do_segmentview_1.refreshItems();
/***********************************************************/
//滑动时改变字体颜色的方法
 var changecolor = function(index){
   segment_listdata.removeAll();
   if (index == 0) {
       segment_listdata.addData([
           {template: 0,name:"会诊专家", fontColor : "F4A415FF", lb:false}, 
           {template: 0,name:"我的会诊", fontColor : "B3B3B3FF", lb:false},
       ]);
   }else if(index==1){
       segment_listdata.addData([
         {template: 0,name:"会诊专家", fontColor : "B3B3B3FF", lb:false},                        
       	{template: 0,name:"我的会诊", fontColor : "F4A415FF", lb:false},
          ]);    

       	}
 	do_segmentview_1.refreshItems();
 }
 /***********************************************************/
 //当segmentview的index变化时,读取
 do_segmentview_1.on("indexChanged", function(index){
 do_slideview_1.set({index: index});
 do_slideview_1.refreshItems({});
 changecolor(index);
 });
 /***********************************************************/
 //slideview绑定数据
 slide_listdata.addData([ 
 	{template: 0},
    {template: 1}
 ]);
 do_slideview_1.refreshItems();
 /***********************************************************/
 //当slideview的index变化时,读取
 do_slideview_1.on("indexChanged", function(index){
 do_segmentview_1.set({index: index});
 changecolor(index);
 });

 /**********************************************************************************************************/